#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    // 阈值
    float threshold;
    cin >> threshold;

    // 两条DNA序列
    string DNA1, DNA2;
    cin >> DNA1 >> DNA2;

    int len1 = DNA1.length();
    int len2 = DNA2.length();
    int maxLen = len1>len2 ? len1 : len2;

    // 1，长度只差已经超过阈值所限，直接判定这两条DNA不相关
    if(abs(len1-len2)/(float)maxLen > (1-threshold))
    {
        cout << "no" << endl;
        return 0;
    }

    // 逐个比对每个碱基对
    int same = 0;
    for(int i=0; i<len1 && i<len2; i++)
    {
        if(DNA1[i] == DNA2[i])
            same++;
    }

    if(same/(float)maxLen >= threshold)
        cout << "yes" << endl;
    else
        cout << "no" << endl;

    return 0;
}